package com.jackrain.nea.web.model;

import java.io.Serializable;
import java.util.HashMap;

public class UserConfig implements Serializable {
    
    private static final long serialVersionUID = -1704642472081195942L;

//    private static final long serialVersionUID = -1L;

    //表隐藏字段配置
    HashMap<Long, String> hideColumnMap;

    //多选结果集保存
    HashMap<Long, HashMap<String,String>> multiQueryMap;

    //表隐藏字段配置
    HashMap<String,String> param;


    public HashMap getHideColumnMap() {
        return hideColumnMap;
    }

    public void addHideColumn(Long tableId, String hideColumn) {
        if (hideColumnMap == null) {
            hideColumnMap = new HashMap<>();
        }
        hideColumnMap.put(tableId, hideColumn);
    }


    public void delHideColumn(Long talbeId) {
        if (hideColumnMap != null) {
            hideColumnMap.remove(talbeId);
        }
    }

    public String getHideColumn(Long tableId) {
        if (hideColumnMap != null) {
            return hideColumnMap.get(tableId);
        }
        return null;
    }


    public HashMap getMultiQueryMap() {
        return multiQueryMap;
    }

    public HashMap getMultiQueryByTable(Long tableid) {
        if (multiQueryMap != null) {
            return multiQueryMap.get(tableid);
        }
        return null;
    }

    public String getMultiQueryByModel(Long tableid, String modelName) {
        if (multiQueryMap != null && multiQueryMap.get(tableid) != null) {
            return multiQueryMap.get(tableid).get(modelName);
        }
        return null;
    }

    public void addMultiQuery(Long tableId,String modelName, String multiQuery) {
        if (multiQueryMap != null && multiQueryMap.get(tableId) != null) {
            multiQueryMap.get(tableId).put(modelName,multiQuery);
        }else if(multiQueryMap != null && multiQueryMap.get(tableId) == null){
            HashMap map = new HashMap();
            map.put(modelName,multiQuery);
            multiQueryMap.put(tableId,map);
        }else if(multiQueryMap == null){
            multiQueryMap = new HashMap<>();
            HashMap map = new HashMap();
            map.put(modelName,multiQuery);
            multiQueryMap.put(tableId,map);
        }
    }


    public void delMultiQuery(Long tableId, String modelName) {
        if (multiQueryMap != null && multiQueryMap.get(tableId) != null) {
            multiQueryMap.get(tableId).remove(modelName);
        }
    }

    public void setParam(HashMap<String, String> param) {
        this.param = param;
    }

    public HashMap getParam() {
        return param;
    }

    public String getParam(String key) {
        if (param != null) {
            return param.get(key);
        }
        return null;
    }

    public void addParam(String key,String value) {
        if (param == null) {
            param = new HashMap<>();
        }
        param.put(key, value);
    }

}
